﻿using System;
using System.Runtime.InteropServices;

namespace QuotationService.RealtimeQuotation
{
    /// <summary>
    /// 行情信息
    /// </summary>
    [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
    internal struct ComboQuotationInfo
    {

        /// <summary>
        /// 序号
        /// </summary>
        public Int32 SN;

        /// <summary>
        /// 所属用户的唯一标识
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MarshalSizeConsts.AuthCodeLength)]
        public string AuthCode;

        /// <summary>
        /// 商品代码
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MarshalSizeConsts.CodeLength)]
        public string Code;

        /// <summary>
        /// 商品名称
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MarshalSizeConsts.NameLength)]
        [ServiceManager.Utils.Encoding("UTF-8")]
        public string Name;

        /// <summary>
        /// 买一价
        /// </summary>
        public double BuyPrice;

        /// <summary>
        /// 卖一价
        /// </summary>
        public double SellPrice;

        /// <summary>
        /// 加权平均买价
        /// </summary>
        public double BuyAutoCostPrice;

        /// <summary>
        /// 卖盘均价
        /// </summary>
        public double SellAutoCostPrice;

        /// <summary>
        /// 逐笔信息
        /// </summary>
        [MarshalAs(UnmanagedType.Struct)]
        public ComboTickInfo Tick;

        /// <summary>
        ///记录更新的时间
        /// </summary>
        public DateTime UpdateTime;

        /// <summary>
        /// 读取行情记录的时间
        /// </summary>
        public DateTime QuotationTime;
    }
}
